package com.youyi.yyviewsdklibrary.Dialog.impl;

import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import com.youyi.yyviewsdklibrary.Dialog.XPopup;
import com.youyi.yyviewsdklibrary.Dialog.interfaces.OnCancelListener;
import com.youyi.yyviewsdklibrary.Dialog.interfaces.OnInputConfirmListener;
import com.youyi.yyviewsdklibrary.Dialog.util.XPopupUtils;

public class InputConfirmPopupView extends ConfirmPopupView implements View.OnClickListener {
    OnCancelListener cancelListener;
    OnInputConfirmListener inputConfirmListener;
    public CharSequence inputContent;

    public InputConfirmPopupView(Context context, int i) {
        super(context, true, i);
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.CenterPopupView, com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView, com.youyi.yyviewsdklibrary.Dialog.impl.ConfirmPopupView
    public void onCreate() {
        super.onCreate();
        this.et_input.setVisibility(View.VISIBLE);
        if (!TextUtils.isEmpty(this.hint)) {
            this.et_input.setHint(this.hint);
        }
        if (!TextUtils.isEmpty(this.inputContent)) {
            this.et_input.setText(this.inputContent);
            this.et_input.setSelection(this.inputContent.length());
        }
        XPopupUtils.setCursorDrawableColor(this.et_input, XPopup.getPrimaryColor());
        int i = this.bindLayoutId;
    }

    public EditText getEditText() {
        return this.et_input;
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.CenterPopupView, com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView, com.youyi.yyviewsdklibrary.Dialog.impl.ConfirmPopupView
    public void applyLightTheme() {
        super.applyLightTheme();
        this.et_input.setHintTextColor(Color.parseColor("#888888"));
        this.et_input.setTextColor(Color.parseColor("#333333"));
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.CenterPopupView, com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView, com.youyi.yyviewsdklibrary.Dialog.impl.ConfirmPopupView
    public void applyDarkTheme() {
        super.applyDarkTheme();
        this.et_input.setHintTextColor(Color.parseColor("#888888"));
        this.et_input.setTextColor(Color.parseColor("#dddddd"));
    }

    public void setListener(OnInputConfirmListener onInputConfirmListener, OnCancelListener onCancelListener) {
        this.cancelListener = onCancelListener;
        this.inputConfirmListener = onInputConfirmListener;
    }

    @Override // com.youyi.yyviewsdklibrary.Dialog.impl.ConfirmPopupView
    public void onClick(View view) {
        if (view == this.tv_cancel) {
            OnCancelListener onCancelListener = this.cancelListener;
            if (onCancelListener != null) {
                onCancelListener.onCancel();
            }
            dismiss();
        } else if (view == this.tv_confirm) {
            OnInputConfirmListener onInputConfirmListener = this.inputConfirmListener;
            if (onInputConfirmListener != null) {
                onInputConfirmListener.onConfirm(this.et_input.getText().toString().trim());
            }
            if (this.popupInfo.autoDismiss.booleanValue()) {
                dismiss();
            }
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.youyi.yyviewsdklibrary.Dialog.core.CenterPopupView, com.youyi.yyviewsdklibrary.Dialog.core.BasePopupView, com.youyi.yyviewsdklibrary.Dialog.impl.ConfirmPopupView
    public int getMaxWidth() {
        return this.popupInfo.maxWidth == 0 ? super.getMaxWidth() : this.popupInfo.maxWidth;
    }
}
